<!DOCTYPE html>
<html>
    <head>
        <title>Issue 6291: use evalInGlobalWithBindings() instead of eval()</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <link href="../../_common/testcase.css" type="text/css" rel="stylesheet"/>
        <script>
            function log()
            {
                console.log("some text via the webpage");
            }
            function debugMe()
            {
                debugger;
            }
        </script>
    </head>
    <body>
        <header>
            <h1><a href="http://code.google.com/p/fbug/issues/detail?id=6291">Issue 6291</a>: use evalInGlobalWithBindings() instead of eval()</h1>
        </header>
        <div>
            <section id="content">
                <p><a href="#" onclick="log();" id="logSomeText">Log some text</a></p>
                <p><a href="#" onclick="debugMe()" id="debugMe">debug Me</a></p>
            </section>
            <section id="description">
                <h3>Steps to reproduce</h3>
                <ol>
                    <li>Open Firebug on this page</li>
                    <li>Enable and switch to the Console panel</li>
                    <li>
                        Evaluate this expression:
                            <code>atob("b");</code>
                        <br/>&#x21b3; An exception should be displayed with the correct source and line
                    </li>
                    <!--
                    <li>
                        Click on the source of the previous exception
                        <br/>&#x21b3; The source of the exception should be displayed in a new window
                    </li>
                    -->
                    <li>
                        Evaluate: <code>console.log("some text via the command line");</code>
                        <br/>&#x21b3; No source link should be displayed
                    </li>
                    <li>
                        Click on <i>"Log Some Text"</i>
                        <br/>&#x21b3; A source link to the <code>log()</code> function should appear
                    </li>
                    <li>
                        Evaluate in Command Editor mode: <code>debugger;</code>
                        <br/>&#x21b3; The Command Editor should still be shown
                    </li>
                    <li>
                        Click on <i>"debug Me"</i>
                        <br/>&#x21b3; Firebug should switch automatically to the Script panel
                            and the execution of debugMe should be paused
                    </li>
                    <li>
                        Switch to the <i>Stack</i> Side panel
                        <br/>&#x21b3; The current side panel should be <i>Stack</i> now
                    </li>
                    <li>
                        Press F8 to continue and switch back to the <i>Console</i> Panel
                    </li>
                    <li>
                        Evaluate: <code>throw "aaa";</code>
                        <br/>&#x21b3; An error should be displayed as follow: "Error: aaa"
                    </li>
                    <li>
                        Evaluate: <code>window.cd = "ok";</code>
                    </li>
                    <li>
                        Evaluate: <code>cd</code>
                        <br/>&#x21b3; should return "ok"
                    </li>
                    <li>
                        Evaluate: <code>delete window.cd;</code>
                    </li>
                    <li>
                        Evaluate: <code>cd.toSource();</code>
                        <br/>&#x21b3; Should return :
                            <code style="color:red;">
                                <br/>"function () {<br/>    [native code]<br/>}"
                            </code>
                    </li>
                </ol>
            </section>
            <footer>
                Florent FAYOLLE, <i>florent.fayolle69@gmail.com</i>
            </footer>
        </div>
    </body>
</html>
